package animations;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

import org.apache.log4j.Logger;

import ui.AbsAnimationPanel;

/**
 * 
 * @author manh.vu
 * 
 */
public class DrawSheet extends AbsAnimationPanel {
	private static final Logger LOGGER = Logger.getLogger(DrawSheet.class);
	/**
	 * 
	 */
	private static final long serialVersionUID = -2126696113734641179L;

	public DrawSheet() {
		super();
		LOGGER.info("Initialize " + DrawSheet.class.getCanonicalName());
	}

	@Override
	public void initialize() {
		super.initialize();

		NetGround netGround = new NetGround(this.getSize());
		addGameObjects(netGround);

		addMouseListener(new MouseAdapter() {
			@Override
			public void mouseReleased(MouseEvent e) {
				MyBall myBall = new MyBall(e.getX(), e.getY(), Color.DARK_GRAY, 50);
				addGameObjects(myBall);

				if(getNumberOfObjects() > 4) {
					removeGameObjects(1);
				}
			}
		});
	}

	@Override
	protected void gameOverMessage(Graphics2D g) {
		// TODO Auto-generated method stub

	}

	@Override
	public void sleep() {
		// TODO Auto-generated method stub

	}
}
